#include "VideogameProcess.h"
#include "GraphicsManager.h"
#include "Font/FontManager.h"
#include "Math/Matrix44.h"


CVideogameProcess::CVideogameProcess(void)
{
	m_Angle=0;
}


CVideogameProcess::~CVideogameProcess(void)
{
	DeInit();
}

void CVideogameProcess::Update(float l_DeltaTime)
{
	m_Angle=m_Angle+0.001;
}

void CVideogameProcess::RenderScene(CGraphicsManager *l_GraphicsManager,float l_DeltaTime)
{
	//l_GraphicsManager->Debug_DrawGrid(5.0, 6, colMAGENTA);
	//l_GraphicsManager->Debug_DrawGrid(5.0, 2.0, 6, colCYAN);
	//l_GraphicsManager->Debug_DrawCube(1.0, colCYAN);
	//l_GraphicsManager->Debug_DrawSphere(2,20,colCYAN);
	Mat44f l_Matrix;
	l_Matrix.SetIdentity();
	l_GraphicsManager->SetTransform(l_Matrix);
	l_GraphicsManager->Debug_DrawAxis(2.0);
	l_GraphicsManager->Debug_DrawSphere(1.0,20,colYELLOW);
	l_Matrix.SetIdentity();
	
	/*l_Matrix.Translate(Vect3f(0,0,5));
	l_Matrix.Scale(1,1,1);
	l_Matrix.RotByAnglesYXZ(0,0,0);*/
	Mat44f l_Rotate,l_Rotate2, l_Translate, l_Translate2,l_Matrix2;
	l_Matrix2.SetIdentity();
	l_Rotate.SetIdentity();
	l_Rotate2.SetIdentity();
	l_Translate.SetIdentity();
	l_Translate2.SetIdentity();
	l_Rotate.RotByAngleY(m_Angle);
	l_Rotate2.RotByAngleY(m_Angle);
	l_Translate.Translate(Vect3f(0,0,3));
	l_Translate2.Translate(Vect3f(0,0,1));
	l_Matrix=l_Rotate*l_Translate*l_Rotate;
	l_Matrix2=l_Rotate*l_Translate*l_Rotate*l_Translate2*l_Rotate;
	l_GraphicsManager->SetTransform(l_Matrix2);
	l_GraphicsManager->Debug_DrawSphere(0.1,10,colWHITE);
	l_GraphicsManager->SetTransform(l_Matrix);
	l_GraphicsManager->Debug_DrawSphere(0.5,10,colBLUE);
}

void CVideogameProcess::RenderScene2D(CGraphicsManager *l_GraphicsManager, CFontManager *l_FontManager, float l_DeltaTime)
{
	uint32 size=l_FontManager->DrawDefaultText(100,100, colBLACK, "Hello World");
	uint32 id =l_FontManager->GetTTF_Id("futurama");
	size+=l_FontManager->DrawText(100, size, colRED, id, "Fuente");
	size+=l_FontManager->DrawLiteral(100,size, "HiWorld");
}

void CVideogameProcess::Init()
{
	int kk=0;
}

void CVideogameProcess::DeInit()
{
	int kk=0;
}
uint32 CVideogameProcess::RenderDebugInfo(CGraphicsManager *l_GraphicsManager, CFontManager *l_FontManager, float l_Fps)
{
	CProcess::RenderDebugInfo(l_GraphicsManager, l_FontManager, l_Fps);
	return 0;
}